package com.chunfen.dubbo.provider;

import com.chunfen.dubbo.framework.URL;
import com.chunfen.dubbo.protocol.http.HttpServer;
import com.chunfen.dubbo.provider.api.HelloService;
import com.chunfen.dubbo.provider.service.HelloServiceImpl;
import com.chunfen.dubbo.register.RemoteRegister;

public class Provider {

    public static void main(String[] args) {

        // 本地注册
        // {服务名:实现类}

        LocalRegister.regist(HelloService.class.getName(), HelloServiceImpl.class);

        // 远程注册
        // {服务名:List<URL>}

        URL url = new URL("localhost", 8080);
        RemoteRegister.regist(HelloService.class.getName(), url);

        // 启动tomcat

        HttpServer httpServer = new HttpServer();
        httpServer.start("localhost", 8080);

    }
}
